home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / OWLINC.PAK / PRINTDIA.H < prev    next >
C/C++ Source or Header  |  1997-05-06  |  5KB  |  189 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // Copyright (c) 1992, 1997 by Borland International, All Rights Reserved
  4. //
  5. //$Revision:   10.4  $
  6. //
  7. // Definition of Print and PrintSetup common Dialogs classes
  8. //----------------------------------------------------------------------------
  9. #if !defined(OWL_PRINTDIA_H)
  10. #define OWL_PRINTDIA_H
  11.  
  12. #if !defined(OWL_COMMDIAL_H)
  13. # include <owl/commdial.h>
  14. #endif
  15. #if !defined(OWL_DC_H)
  16. # include <owl/dc.h>
  17. #endif
  18.  
  19. #if defined(BI_NAMESPACE)
  20. namespace OWL {
  21. #endif
  22.  
  23. // Generic definitions/compiler options (eg. alignment) preceeding the 
  24. // definition of classes
  25. #include <services/preclass.h>
  26.  
  27. //
  28. // class TPrintDialog
  29. // ~~~~~ ~~~~~~~~~~~~
  30. class _OWLCLASS TPrintDialog : public TCommonDialog {
  31.   public:
  32.     class _OWLCLASS TData {
  33.       public:
  34.         uint32          Flags;
  35.         uint32          Error;
  36.         int             FromPage;
  37.         int             ToPage;
  38.         int             MinPage;
  39.         int             MaxPage;
  40.         int             Copies;
  41.  
  42. #if defined(BI_PLAT_WIN32)  
  43.         uint32          PageSetupFlags;    // Additional page setup dialog flags
  44.         TPoint          PaperSize;         // Size of the paper user has chosen
  45.         TRect           MinMargin;         // Minimum allowable margins of the paper
  46.         TRect           Margin;            // Initial margins for the paper
  47.         bool            DoPageSetup;       // Flag to do page setup?
  48. #endif
  49.  
  50.         TData();
  51.        ~TData();
  52.         void                Lock();
  53.         void                Unlock();
  54.         void                ClearDevMode();
  55.         const DEVMODE far*  GetDevMode() const;
  56.         void                SetDevMode(const DEVMODE far* devMode);
  57.         void                ClearDevNames();
  58.         const DEVNAMES far* GetDevNames() const;
  59.         const char far*     GetDriverName() const;
  60.         const char far*     GetDeviceName() const;
  61.         const char far*     GetOutputName() const;
  62.         void                SetDevNames(const char far* driver,
  63.                                         const char far* device,
  64.                                         const char far* output);
  65.         TPrintDC*           TransferDC();
  66.  
  67.         void*               Read(ipstream& is, uint32 version);
  68.         void                Write(opstream& os);
  69.  
  70.       private:
  71.         HGLOBAL       HDevMode;
  72.         HGLOBAL       HDevNames;
  73.         HDC           HDc;
  74.  
  75.         DEVMODE far*  DevMode;
  76.         DEVNAMES far* DevNames;
  77.  
  78.         TData(const TData&);         // hidden to prevent copying & assignment
  79.         TData& operator =(const TData&);
  80.  
  81.       friend class TPrintDialog;
  82.     };
  83.  
  84.     TPrintDialog(TWindow*        parent,
  85.                  TData&          data,
  86.                  const char far* printTemplateName = 0,
  87.                  const char far* setupTemplateName = 0,
  88.                  const char far* title = 0,
  89.                  TModule*        module = 0);
  90.  
  91.     bool       GetDefaultPrinter();
  92.  
  93.     int        DoExecute();
  94.  
  95.   protected:
  96.     bool    DialogFunction(uint message, TParam1, TParam2);
  97.  
  98.     // Default behavior inline for message response functions
  99.     //
  100.     void       CmSetup(); //EV_COMMAND(psh1,
  101.  
  102.     PRINTDLG&  GetPD();
  103.     void       SetPD(const PRINTDLG& _pd);
  104.  
  105.     TData&     GetData();
  106.     void       SetData(const TData& data);
  107.  
  108.   protected_data:
  109.     union {
  110.       PRINTDLG     pd;  // old name
  111.       PRINTDLG     Pd;  // new name
  112.     };
  113. #if defined(BI_PLAT_WIN32)
  114.     PAGESETUPDLG   Psd;
  115. #endif
  116.     TData&         Data;
  117.  
  118.   private:
  119.     TPrintDialog(const TPrintDialog&);
  120.     TPrintDialog& operator=(const TPrintDialog&);
  121.  
  122.   DECLARE_RESPONSE_TABLE(TPrintDialog);
  123.   DECLARE_CASTABLE;
  124. };
  125.  
  126. // Generic definitions/compiler options (eg. alignment) following the 
  127. // definition of classes
  128. #include <services/posclass.h>
  129.  
  130. #if defined(BI_NAMESPACE)
  131. } // namespace OWL
  132. #endif
  133.  
  134. // ---------------------------------------------------------------------------
  135. // Inline implementation
  136. //
  137. //
  138.  
  139. //
  140. // Return the DEVMODE structure used by the dialog.
  141. //
  142. inline const DEVMODE far*  TPrintDialog::TData::GetDevMode() const {
  143.   return DevMode;
  144. }
  145.  
  146. //
  147. // Return the DEVNAMES structure used by the dialog.
  148. //
  149. inline const DEVNAMES far* TPrintDialog::TData::GetDevNames() const {
  150.   return DevNames;
  151. }
  152.  
  153. //
  154. // Default processing.
  155. //
  156. inline void TPrintDialog::CmSetup() {
  157.   DefaultProcessing();
  158. }
  159.  
  160. //
  161. // Return the PRINTDLG structure used by the dialog.
  162. //
  163. inline PRINTDLG& TPrintDialog::GetPD() {
  164.   return pd;
  165. }
  166.  
  167. //
  168. // Set the PRINTDLG structure used by the dialog.
  169. //
  170. inline void TPrintDialog::SetPD(const PRINTDLG& _pd) {
  171.   pd = _pd;
  172. }
  173.  
  174. //
  175. // Return the transfer data of the dialog.
  176. //
  177. inline TPrintDialog::TData& TPrintDialog::GetData() {
  178.   return Data;
  179. }
  180.  
  181. //
  182. // Set the transfer data of the dialog.
  183. //
  184. inline void TPrintDialog::SetData(const TData& data) {
  185.   Data = data;
  186. }
  187.  
  188. #endif  // OWL_PRINTDIA_H
  189.